package cn.zcy.springboot_mybatis.controller;

import cn.zcy.springboot_mybatis.domain.Emp;
import cn.zcy.springboot_mybatis.result.Result;
import cn.zcy.springboot_mybatis.service.IEmpService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emp")
public class EmpController {

    @Autowired
    private IEmpService empService;

    /**
     * 查询所有
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping("/list")
    public Result getEmpList(@RequestParam(name = "pageNum", defaultValue = "1") int pageNum, @RequestParam(name = "pageNum", defaultValue = "10") int pageSize) {
        PageInfo<Emp> empPageInfo = empService.selectEmpList(pageNum, pageSize);
        return new Result(200, "查询成功", empPageInfo);
    }
}
